package com.atchangsha.system.dto;


import com.atchangsha.system.entity.SalesBillEntity;
import lombok.*;

import java.io.Serializable;
import java.util.Date;

@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SalesBillDTO implements Serializable {
    /**
     * 主键
     */
    private Long id;
    /**
     * 订单编号
     */
    private Long orderId;
    /**
     * 消费金额
     */
    private Float price;
    /**
     * 折扣后金额
     */
    private Float priceAfter;
    /**
     * 账单时间
     */
    private Date time;

    /**
     * 将DTO对象转换成entity对象
     *
     * @return entity对象
     */
    public SalesBillEntity toEntity(){
        return SalesBillEntity.builder()
                .id(id)
                .orderId(orderId)
                .price(price)
                .priceAfter(priceAfter)
                .time(time)
                .build();
    }
}
